<template>
  <div>
    <file-list :biz_id="bizId" :type="type" :is_public="true" v-if="bizId" />
  </div>
</template>

<script>

export default {
  data() {
    let typeMap = { '0': 'dataset', '1': 'workspace', '2': 'model' }
    return {
      bizId: null,
      type: typeMap[this.$route.query.active]
    };
  },
  props: ['source', 'version', 'detailData'],
  watch: {
    version(val) {
      this.detail = val
      if (this.type != 'dataset') {
        this.bizId = val.id
      }
    },
    detailData(val) {
      if (this.type == 'dataset') {
        this.bizId = val.source
      }
    }
  },
  async created() {

  },
  mounted() {
    // this.detail = this.version
    // console.log(this.detail)
    // console.log(this.source)
    if (this.type == 'dataset') {
      this.bizId = this.source
    }
    if (this.type == 'model') {
      this.bizId = this.version.id
    }
    if (this.type == 'workspace') {
      this.bizId = this.version && this.version.id
    }


  },
  destroyed() {

  },
  methods: {
    getBizId() {

    }
  }
}
</script>
<style lang="less" scoped></style>